package com.orchid.community.models.controller;

import cn.hutool.core.util.StrUtil;
import com.orchid.community.common.utils.MsgResponse;
import com.orchid.community.common.utils.ResultUtils;
import com.orchid.community.models.DTO.CommonParam;
import com.orchid.community.models.DTO.MissionDto;
import com.orchid.community.models.DTO.UserDTO;
import com.orchid.community.models.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;


    @PostMapping("getUserList")
    public MsgResponse getUserList(@RequestBody UserDTO userDTO) {
        return userService.getUserList(userDTO);
    }

    @PostMapping("/setTag")
    public MsgResponse setTag(@RequestBody CommonParam commonParam){
        if(StringUtils.isEmpty(commonParam.getId()) || StringUtils.isEmpty(commonParam.getTags())){
            return ResultUtils.fail("请输入正确的id和标签");
        }

        return userService.setTag(commonParam);
    }

    @PostMapping("/getPeoplePage")
    public MsgResponse getPeoplePage(@RequestBody UserDTO userDTO){
        return userService.getPeoplePage(userDTO);
    }



}
